#include "contact.h"

Contact::Contact(QWidget *parent) : QWidget(parent)
{
    //新建电子邮件标签及文本编辑框
    EmailLabel = new QLabel(tr("Email:"));
    EmailLineEdit = new QLineEdit;
    //新建联系地址标签及文本编辑框
    AddrLabel = new QLabel(tr("Addr:"));
    AddrLineEdit = new QLineEdit;
    //新建邮政编码标签及文本编辑框
    CodeLabel = new QLabel(tr("Code:"));
    CodeLineEdit = new QLineEdit;
    //新建移动电话标签及文本编辑框
    MoviTelLabel = new QLabel(tr("MoviTel:"));
    MoviTelLineEdit = new QLineEdit;
    MoviTelCheckBook = new QCheckBox(tr("MoviTelCheck"));
    //新建办公电话标签及文本编辑框
    ProTelLabel = new QLabel(tr("ProTel:"));
    ProTelLineEdit = new QLineEdit;

    //新建全局布局管理器，将上面新建的各个控件添加进来，完成当前界面的布局管理。
    mainLayout = new QGridLayout(this);
    mainLayout->setMargin(15);
    mainLayout->setSpacing(10);
    mainLayout->addWidget(EmailLabel, 0, 0);
    mainLayout->addWidget(EmailLineEdit, 0, 1);
    mainLayout->addWidget(AddrLabel, 1, 0);
    mainLayout->addWidget(AddrLineEdit, 1, 1);
    mainLayout->addWidget(CodeLabel, 2, 0);
    mainLayout->addWidget(CodeLineEdit, 2, 1);
    mainLayout->addWidget(MoviTelLabel, 3, 0);
    mainLayout->addWidget(MoviTelLineEdit, 3, 1);
    mainLayout->addWidget(MoviTelCheckBook, 3, 2);
    mainLayout->addWidget(ProTelLabel, 4, 0);
    mainLayout->addWidget(ProTelLineEdit, 4, 1);
    mainLayout->setSizeConstraint(QLayout::SetFixedSize);
}
